package cn.itsource.pojo.dto;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @program fccar
 * @Author luoc
 * @Date 2024/09/07 0:05
 * @Version 1.0.0
 * @Description
 */

@Getter
public enum UserLevelConst {
    BRONZE(0L,"青铜"),
    SILVER(1L,"青铜"),
    GOLD(2L,"青铜"),
    PLATIUM(3L,"青铜"),
    MASTER(4L,"青铜"),
    GRADMASTR(5L,"青铜"),
    KING(6L,"青铜");

    private Long key;
    private String value;

    UserLevelConst(Long key,String value){
        this.key = key;
        this.value = value;
    }

    /**
     * @param key:
     * @return UserLevelConst
     * @date 2024-09-07
     * @description 根据key获取UserLevelConst
     */
    public UserLevelConst getLeveByKey(Long key){
        UserLevelConst[] values = UserLevelConst.values();
        Optional<UserLevelConst> any = Arrays.stream(values).filter(item -> item.key.equals(key)).findAny();
        return any.get();
    }

}
